
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>5种常见函数的写法和调用方式 · 记录技术文档内容</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="zhengyuliang">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-sectionx/sectionx.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="7道javascript题，让你理解基本的javascript.html" />
    
    
    <link rel="prev" href="5个技巧让你更好的编写 JavaScript(ES6" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">CSS</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../CSS/18种CSS命名和书写规范.html">
            
                <a href="../CSS/18种CSS命名和书写规范.html">
            
                    
                    18种CSS命名和书写规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../CSS/灵活运用CSS开发技巧.html">
            
                <a href="../CSS/灵活运用CSS开发技巧.html">
            
                    
                    灵活运用CSS开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../CSS/自适应 flex grid.html">
            
                <a href="../CSS/自适应 flex grid.html">
            
                    
                    自适应 Flex Grid
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">HTML</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../HTML/浏览器里的本地数据库：IndexedDB.html">
            
                <a href="../HTML/浏览器里的本地数据库：IndexedDB.html">
            
                    
                    浏览器里的本地数据库：IndexedDB
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Vue</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../Vue/7个有用的Vue开发技巧.html">
            
                <a href="../Vue/7个有用的Vue开发技巧.html">
            
                    
                    7个有用的Vue开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../Vue/Vue this.$router.push、replace、go的区别.html">
            
                <a href="../Vue/Vue this.$router.push、replace、go的区别.html">
            
                    
                    Vue This.$Router.Push、Replace、Go的区别
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="../Vue/Vue 的父组件和子组件生命周期钩子函数执行顺序？.html">
            
                <a href="../Vue/Vue 的父组件和子组件生命周期钩子函数执行顺序？.html">
            
                    
                    Vue 的父组件和子组件生命周期钩子函数执行顺序？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="../Vue/Vue.set和this.$set应用的场景.html">
            
                <a href="../Vue/Vue.set和this.$set应用的场景.html">
            
                    
                    Vue.Set和This.$Set应用的场景
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="../Vue/vue高级技巧.html">
            
                <a href="../Vue/vue高级技巧.html">
            
                    
                    Vue高级技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="../Vue/从 0 开始手把手带你搭建一套规范的 Vue3.x 项目工程环境.html">
            
                <a href="../Vue/从 0 开始手把手带你搭建一套规范的 Vue3.x 项目工程环境.html">
            
                    
                    从 0 开始手把手带你搭建一套规范的 Vue3.X 项目工程环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="../Vue/浅析 vue-router 源码和动态路由权限分配.html">
            
                <a href="../Vue/浅析 vue-router 源码和动态路由权限分配.html">
            
                    
                    浅析 Vue Router 源码和动态路由权限分配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="../Vue/父组件监听到子组件的生命周期.html">
            
                <a href="../Vue/父组件监听到子组件的生命周期.html">
            
                    
                    父组件监听到子组件的生命周期
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="../Vue/理解Vue.mixin，利用Vue.mixin正确的偷懒.html">
            
                <a href="../Vue/理解Vue.mixin，利用Vue.mixin正确的偷懒.html">
            
                    
                    理解Vue.Mixin，利用Vue.Mixin正确的偷懒
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">JavaScript</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="5个技巧让你更好的编写 JavaScript(ES6">
            
                <span>
            
                    
                    5个技巧让你更好的编写 JavaScript(ES6) 中条件语句
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="4.2" data-path="5种常见函数的写法和调用方式.html">
            
                <a href="5种常见函数的写法和调用方式.html">
            
                    
                    5种常见函数的写法和调用方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="7道javascript题，让你理解基本的javascript.html">
            
                <a href="7道javascript题，让你理解基本的javascript.html">
            
                    
                    7道Javascript题，让你理解基本的Javascript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="Array.from(">
            
                <span>
            
                    
                    Array.From() 五个超好用的用途
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="ES6汇总资料.html">
            
                <a href="ES6汇总资料.html">
            
                    
                    ES6汇总资料
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="JS开发必须知道的41个技巧.html">
            
                <a href="JS开发必须知道的41个技巧.html">
            
                    
                    JS开发必须知道的41个技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="JavaScript之防抖Debounce和节流Throttle.html">
            
                <a href="JavaScript之防抖Debounce和节流Throttle.html">
            
                    
                    JavaScript之防抖Debounce和节流Throttle
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="JavaScript数组求并集，交集和差集.html">
            
                <a href="JavaScript数组求并集，交集和差集.html">
            
                    
                    JavaScript数组求并集，交集和差集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="JavaScript的优雅写法.html">
            
                <a href="JavaScript的优雅写法.html">
            
                    
                    JavaScript的优雅写法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="axios知识点.html">
            
                <a href="axios知识点.html">
            
                    
                    Axios知识点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="javascript核心知识.html">
            
                <a href="javascript核心知识.html">
            
                    
                    Javascript核心知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.12" data-path="this、apply、call、bind.html">
            
                <a href="this、apply、call、bind.html">
            
                    
                    This、Apply、Call、Bind
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.13" data-path="前端js常用的60余种工具方法.html">
            
                <a href="前端js常用的60余种工具方法.html">
            
                    
                    前端Js常用的60余种工具方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.14" data-path="前端异常的捕获与处理.html">
            
                <a href="前端异常的捕获与处理.html">
            
                    
                    前端异常的捕获与处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.15" data-path="在 JavaScript 中交换值的 10 种方法.html">
            
                <a href="在 JavaScript 中交换值的 10 种方法.html">
            
                    
                    在 JavaScript 中交换值的 10 种方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.16" data-path="常用的前端JavaScript方法封装.html">
            
                <a href="常用的前端JavaScript方法封装.html">
            
                    
                    常用的前端JavaScript方法封装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.17" data-path="异步神器Async-await介绍与填坑.html">
            
                <a href="异步神器Async-await介绍与填坑.html">
            
                    
                    异步神器Async Await介绍与填坑
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.18" data-path="灵活运用JS开发技巧.html">
            
                <a href="灵活运用JS开发技巧.html">
            
                    
                    灵活运用JS开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.19" data-path="编写高质量可维护的代码：一目了然的注释.html">
            
                <a href="编写高质量可维护的代码：一目了然的注释.html">
            
                    
                    编写高质量可维护的代码：一目了然的注释
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.20" data-path="编写高质量可维护的代码：优化逻辑判断.html">
            
                <a href="编写高质量可维护的代码：优化逻辑判断.html">
            
                    
                    编写高质量可维护的代码：优化逻辑判断
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.21" data-path="编写高质量可维护的代码：优雅命名.html">
            
                <a href="编写高质量可维护的代码：优雅命名.html">
            
                    
                    编写高质量可维护的代码：优雅命名
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.22" data-path="编写高质量可维护的代码：数据建模.html">
            
                <a href="编写高质量可维护的代码：数据建模.html">
            
                    
                    编写高质量可维护的代码：数据建模
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Life Exp</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../life_exp/告别平庸的15个小方法.html">
            
                <a href="../life_exp/告别平庸的15个小方法.html">
            
                    
                    告别平庸的15个小方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../life_exp/日志记录.html">
            
                <a href="../life_exp/日志记录.html">
            
                    
                    日志记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="../life_exp/程序员的发展方向.html">
            
                <a href="../life_exp/程序员的发展方向.html">
            
                    
                    程序员的发展方向
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="../message/">
            
                <a href="../message/">
            
                    
                    Message
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Technology</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../technology/WebSocket.html">
            
                <a href="../technology/WebSocket.html">
            
                    
                    WebSocket
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="../technology/npm常用命令大全.html">
            
                <a href="../technology/npm常用命令大全.html">
            
                    
                    Npm常用命令大全
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="../technology/智能照明项目说明.html">
            
                <a href="../technology/智能照明项目说明.html">
            
                    
                    智能照明项目说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="../technology/规范化git的提交信息.html">
            
                <a href="../technology/规范化git的提交信息.html">
            
                    
                    规范化Git的提交信息
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Tutorial</li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="../tutorial/Esmap地图详解.html">
            
                <a href="../tutorial/Esmap地图详解.html">
            
                    
                    Esmap地图详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="../tutorial/npm镜像切换.html">
            
                <a href="../tutorial/npm镜像切换.html">
            
                    
                    Npm镜像切换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="../tutorial/发布npm的教程.html">
            
                <a href="../tutorial/发布npm的教程.html">
            
                    
                    发布Npm的教程
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >5种常见函数的写法和调用方式</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <html><head></head><body><div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><ul><li><span class="title-icon "></span><a href="#5&#x79CD;&#x5E38;&#x89C1;&#x51FD;&#x6570;&#x7684;&#x5199;&#x6CD5;&#x548C;&#x8C03;&#x7528;&#x65B9;&#x5F0F;"><b>1.1. </b>5&#x79CD;&#x5E38;&#x89C1;&#x51FD;&#x6570;&#x7684;&#x5199;&#x6CD5;&#x548C;&#x8C03;&#x7528;&#x65B9;&#x5F0F;</a></li></ul></ul></div><a href="#" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h2 id="5&#x79CD;&#x5E38;&#x89C1;&#x51FD;&#x6570;&#x7684;&#x5199;&#x6CD5;&#x548C;&#x8C03;&#x7528;&#x65B9;&#x5F0F;"><a name="5&#x79CD;&#x5E38;&#x89C1;&#x51FD;&#x6570;&#x7684;&#x5199;&#x6CD5;&#x548C;&#x8C03;&#x7528;&#x65B9;&#x5F0F;" class="anchor-navigation-ex-anchor" href="#5&#x79CD;&#x5E38;&#x89C1;&#x51FD;&#x6570;&#x7684;&#x5199;&#x6CD5;&#x548C;&#x8C03;&#x7528;&#x65B9;&#x5F0F;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. 5&#x79CD;&#x5E38;&#x89C1;&#x51FD;&#x6570;&#x7684;&#x5199;&#x6CD5;&#x548C;&#x8C03;&#x7528;&#x65B9;&#x5F0F;</h2>
<blockquote>
<p> &#x51FD;&#x6570;&#x5728;&#x5F00;&#x53D1;&#x4E2D;&#x968F;&#x5904;&#x53EF;&#x89C1;&#xFF0C;&#x7ECF;&#x5E38;&#x5728;&#x5F00;&#x53D1;&#x4E2D;&#x6211;&#x4EEC;&#x58F0;&#x660E;&#x51FD;&#x6570;&#x5C31;&#x4F7F;&#x7528;&#x4E86;&#x4E00;&#x4E24;&#x79CD;&#x5C31;&#x5DF2;&#x7ECF;&#x8DB3;&#x591F;&#x4E86;&#xFF0C;&#x4F46;&#x662F;&#xFF0C;&#x5BF9;&#x6211;&#x8FD9;&#x6709;&#x68A6;&#x60F3;&#x7684;&#x7801;&#x519C;&#x6765;&#x8BF4;&#xFF0C;&#x8FD9;&#x663E;&#x7136;&#x662F;&#x4E0D;&#x591F;&#x7684;&#xFF0C;&#x56E0;&#x6B64;&#xFF0C;&#x603B;&#x7ED3;&#x6574;&#x7406;&#x4E86;5&#x4E2D;&#x5E38;&#x89C1;&#x7684;&#x58F0;&#x660E;&#x65B9;&#x5F0F;&#x548C;&#x8C03;&#x7528;&#x65B9;&#x5F0F;&#x3002; </p>
<p>&#x8BB0;&#x5F55;&#x51FD;&#x6570;&#x7B80;&#x5355;&#x7684;&#x5199;&#x6CD5;&#xFF0C;&#x6700;&#x57FA;&#x672C;&#x529F;&#x4E86;&#xFF0C;&#x8FD9;&#x4E2A;&#x8981;&#x5B66;&#x4E00;&#x4E0B;&#xFF0C;&#x4E0D;&#x80FD;&#x5FD8;&#x8BB0;&#x54AF;</p>
</blockquote>
<h4 id="1&#x3001;&#x51FD;&#x6570;&#x58F0;&#x660E;&#xFF08;&#x6700;&#x5E38;&#x89C4;&#x5199;&#x6CD5;&#xFF09;"><a name="1&#x3001;&#x51FD;&#x6570;&#x58F0;&#x660E;&#xFF08;&#x6700;&#x5E38;&#x89C4;&#x5199;&#x6CD5;&#xFF09;" class="anchor-navigation-ex-anchor" href="#1&#x3001;&#x51FD;&#x6570;&#x58F0;&#x660E;&#xFF08;&#x6700;&#x5E38;&#x89C4;&#x5199;&#x6CD5;&#xFF09;"><i class="fa fa-link" aria-hidden="true"></i></a>1&#x3001;&#x51FD;&#x6570;&#x58F0;&#x660E;&#xFF08;&#x6700;&#x5E38;&#x89C4;&#x5199;&#x6CD5;&#xFF09;</h4>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x5E38;&#x89C4;&#x51FD;&#x6570;&#x5199;&#x6CD5;</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">test</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x8FD9;&#x91CC;&#x662F;&#x5E38;&#x89C4;&#x6D4B;&#x8BD5;&apos;</span>)
}

<span class="hljs-comment">// &#x8C03;&#x7528;&#x51FD;&#x6570;</span>
test();
</code></pre>
<h4 id="2&#x3001;&#x51FD;&#x6570;&#x8868;&#x8FBE;&#x5F0F;&#xFF08;&#x533F;&#x540D;&#x51FD;&#x6570;&#x5199;&#x6CD5;&#xFF09;"><a name="2&#x3001;&#x51FD;&#x6570;&#x8868;&#x8FBE;&#x5F0F;&#xFF08;&#x533F;&#x540D;&#x51FD;&#x6570;&#x5199;&#x6CD5;&#xFF09;" class="anchor-navigation-ex-anchor" href="#2&#x3001;&#x51FD;&#x6570;&#x8868;&#x8FBE;&#x5F0F;&#xFF08;&#x533F;&#x540D;&#x51FD;&#x6570;&#x5199;&#x6CD5;&#xFF09;"><i class="fa fa-link" aria-hidden="true"></i></a>2&#x3001;&#x51FD;&#x6570;&#x8868;&#x8FBE;&#x5F0F;&#xFF08;&#x533F;&#x540D;&#x51FD;&#x6570;&#x5199;&#x6CD5;&#xFF09;</h4>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x533F;&#x540D;&#x51FD;&#x6570;&#x5199;&#x6CD5;</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">test</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x8FD9;&#x91CC;&#x662F;&#x533F;&#x540D;&#x51FD;&#x6570;&#x6D4B;&#x8BD5;&apos;</span>)
}

<span class="hljs-comment">// &#x8C03;&#x7528;&#x51FD;&#x6570;</span>
test();
</code></pre>
<h4 id="3&#x3001;&#x5C06;&#x65B9;&#x6CD5;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;"><a name="3&#x3001;&#x5C06;&#x65B9;&#x6CD5;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;" class="anchor-navigation-ex-anchor" href="#3&#x3001;&#x5C06;&#x65B9;&#x6CD5;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a>3&#x3001;&#x5C06;&#x65B9;&#x6CD5;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;</h4>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x5199;&#x6CD5;</span>
<span class="hljs-keyword">var</span> Test = {
    <span class="hljs-attr">text1</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x8FD9;&#x91CC;&#x662F;&#x6D4B;&#x8BD5;1&apos;</span>)
    },
    <span class="hljs-attr">text2</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x8FD9;&#x91CC;&#x662F;&#x6D4B;&#x8BD5;2&apos;</span>)
    }
}

<span class="hljs-comment">// &#x8C03;&#x7528;&#x51FD;&#x6570;</span>
Test.test1();
Test.test2();
</code></pre>
<h4 id="4&#x3001;&#x6784;&#x9020;&#x51FD;&#x6570;&#x4E2D;&#x7ED9;&#x5BF9;&#x8C61;&#x6DFB;&#x52A0;&#x65B9;&#x6CD5;-&#x5229;&#x7528;&#x539F;&#x578B;&#x7279;&#x6027;&#x5B9E;&#x73B0;"><a name="4&#x3001;&#x6784;&#x9020;&#x51FD;&#x6570;&#x4E2D;&#x7ED9;&#x5BF9;&#x8C61;&#x6DFB;&#x52A0;&#x65B9;&#x6CD5;-&#x5229;&#x7528;&#x539F;&#x578B;&#x7279;&#x6027;&#x5B9E;&#x73B0;" class="anchor-navigation-ex-anchor" href="#4&#x3001;&#x6784;&#x9020;&#x51FD;&#x6570;&#x4E2D;&#x7ED9;&#x5BF9;&#x8C61;&#x6DFB;&#x52A0;&#x65B9;&#x6CD5;-&#x5229;&#x7528;&#x539F;&#x578B;&#x7279;&#x6027;&#x5B9E;&#x73B0;"><i class="fa fa-link" aria-hidden="true"></i></a>4&#x3001;&#x6784;&#x9020;&#x51FD;&#x6570;&#x4E2D;&#x7ED9;&#x5BF9;&#x8C61;&#x6DFB;&#x52A0;&#x65B9;&#x6CD5; (&#x5229;&#x7528;&#x539F;&#x578B;&#x7279;&#x6027;&#x5B9E;&#x73B0;)</h4>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x6784;&#x9020;&#x51FD;&#x6570;&#x5199;&#x6CD5;</span>
<span class="hljs-keyword">var</span> Test = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{}
Test.prototype.way = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x8FD9;&#x91CC;&#x662F;&#x6784;&#x9020;&#x51FD;&#x6570;&#x6D4B;&#x8BD5;&apos;</span>)
}

<span class="hljs-comment">// &#x8C03;&#x7528;&#x51FD;&#x6570;</span>
<span class="hljs-keyword">var</span> funname = <span class="hljs-keyword">new</span> Test(); <span class="hljs-comment">//&#x521B;&#x5EFA;&#x5BF9;&#x8C61;</span>
funname.way(); <span class="hljs-comment">//&#x8C03;&#x7528;&#x5BF9;&#x8C61;&#x5C5E;&#x6027;</span>
</code></pre>
<h4 id="5&#x3001;&#x81EA;&#x6267;&#x884C;&#x51FD;&#x6570;"><a name="5&#x3001;&#x81EA;&#x6267;&#x884C;&#x51FD;&#x6570;" class="anchor-navigation-ex-anchor" href="#5&#x3001;&#x81EA;&#x6267;&#x884C;&#x51FD;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>5&#x3001;&#x81EA;&#x6267;&#x884C;&#x51FD;&#x6570;</h4>
<ol>
<li><p>&#x6700;&#x524D;&#x6700;&#x540E;&#x52A0;&#x62EC;&#x53F7; </p>
<pre><code class="lang-javascript">(<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
   <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6D4B;&#x8BD5;&#x5185;&#x5BB9;1&apos;</span>)
}())
</code></pre>
</li>
<li><p><code>function</code>&#x5916;&#x9762;&#x52A0;&#x62EC;&#x53F7; </p>
<pre><code class="lang-javascript">(<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
   <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6D4B;&#x8BD5;&#x5185;&#x5BB9;2&apos;</span>)
})()
</code></pre>
</li>
<li><p><code>function</code>&#x524D;&#x9762;&#x52A0;&#x8FD0;&#x7B97;&#x7B26;&#xFF0C;&#x5E38;&#x89C1;&#x7684;&#x662F;<code>!</code>&#x4E0E;<code>void</code>&#x3002; </p>
<pre><code class="lang-javascript">!<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
   alert(<span class="hljs-number">1</span>);
}()

<span class="hljs-keyword">void</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
alert(<span class="hljs-number">2</span>);
}()
</code></pre>
</li>
</ol>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; zhengyuliang all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x7F16;&#x5199;&#x65F6;&#x95F4;&#xFF1A;
2019-11-28 09:49:39
</span></footer></body></html>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="5个技巧让你更好的编写 JavaScript(ES6" class="navigation navigation-prev " aria-label="Previous page: 5个技巧让你更好的编写 JavaScript(ES6) 中条件语句">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="7道javascript题，让你理解基本的javascript.html" class="navigation navigation-next " aria-label="Next page: 7道Javascript题，让你理解基本的Javascript">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"5种常见函数的写法和调用方式","level":"4.2","depth":1,"next":{"title":"7道Javascript题，让你理解基本的Javascript","level":"4.3","depth":1,"path":"javaScript/7道javascript题，让你理解基本的javascript.md","ref":"javaScript/7道javascript题，让你理解基本的javascript.md","articles":[]},"previous":{"title":"5个技巧让你更好的编写 JavaScript(ES6) 中条件语句","level":"4.1","depth":1,"path":"javaScript/5个技巧让你更好的编写 JavaScript(ES6","ref":"javaScript/5个技巧让你更好的编写 JavaScript(ES6","articles":[]},"dir":"ltr"},"config":{"plugins":["sectionx","splitter","tbfed-pagefooter","toggle-chapters","theme-comscore","-lunr","-search","search-plus","donate","anchor-navigation-ex","expandable-chapters","chapter-fold","expandable-chapters-small","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy zhengyuliang","modify_label":"该文件编写时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"pluginsConfig":{"anchor-navigation-ex":{"showLevel":false,"showGoTop":true,"isRewritePageTitle":true,"isShowTocTitleIcon":true,"tocLevel1Icon":"fa fa-hand-o-right","tocLevel2Icon":"fa fa-hand-o-right","tocLevel3Icon":"fa fa-hand-o-right"}},"livereload":{},"splitter":{},"donate":{"title":"","button":"赏","wechat":"https://gitee.com/htzyl/img_bed/raw/master/pay/weixin-min.jpg","alipay":"https://gitee.com/htzyl/img_bed/raw/master/pay/alipay-min.jpg","wechatText":"微信打赏","alipayText":"支付宝打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"sectionx":{"tag":"b"},"highlight":{},"anchor-navigation-ex":{"showLevel":true,"associatedWithSummary":true,"mode":"float","showGoTop":true,"printLog":false,"multipleH1":true,"float":{"floatIcon":"fa fa-navicon","showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"theme-comscore":{},"expandable-chapters-small":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"toggle-chapters":{},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"zhengyuliang","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"记录技术文档内容","language":"zh-hans","gitbook":">=3.0.0","description":"记录Gitbook的配置和一些插件的使用","theme-default":{"showLevel":true}},"file":{"path":"javaScript/5种常见函数的写法和调用方式.md","mtime":"2019-11-28T01:49:39.196Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2022-01-06T09:44:01.178Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sectionx/sectionx.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

